#include <tchar.h>
#include <time.h>
#include "WareLog.h"

BEGIN_WARECOMMON

void WareLog::Log( const VCHAR* szLogInfo, ... )
{
	va_list args;
	va_start(args, szLogInfo);
	int32 iBuf;
	VCHAR szBuffer[1024];
	iBuf = _vsntprintf_s( szBuffer, 1024, szLogInfo, args );
	va_end(args);

	struct tm Time;
	time_t ctTime;
	time(&ctTime);
	localtime_s( &Time, &ctTime );
	VCHAR buff[512];
	sprintf_s( buff, 512, "%02d:%02d:%02d ", Time.tm_hour, Time.tm_min, Time.tm_sec );

	VCHAR szBuff[2048];
	sprintf_s( szBuff, 2048, "%s%s", buff, szBuffer );

	m_LogFile.WriteLine( szBuff );
}

END_WARECOMMON